/*
 * @Author: DUST
 * @Date: 2023-11-26 11:05:02
 * @LastEditors: DUST
 * @LastEditTime: 2024-11-11 15:29:35
 * @FilePath: \business-card-system\server\app\model\Company.ts
 * @Description: 
 * undefined
 */
import { Column, DataType, Model, Table } from "sequelize-typescript";

@Table({
  tableName: "company",
  timestamps: true, // 自动维护时间
  freezeTableName: true, // 禁止修改表名，如果不写会把表名自动复数化，users
  paranoid: true, // 软删除
  indexes: [{ unique: true, fields: ["id", "unitId"] }],
})
export default class Company extends Model<Company> {
  @Column({
    type: DataType.INTEGER.UNSIGNED,
    autoIncrement: true,
    primaryKey: true,
    allowNull: false,
    comment: "id",
  })
  id!: number;

  @Column({
    type: DataType.INTEGER,
    allowNull: false,
    comment: "单位唯一标识",
  })
  unitId!: number;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "公司名称"
  })
  name!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: true,
    comment: "公司简称1"
  })
  desName!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: true,
    comment: "公司简称2"
  })
  desName1!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: true,
    comment: "公司简称3"
  })
  desName3!: string;
  
  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "公司地址"
  })
  addr!: string;
  
  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "公司地址2"
  })
  addr2!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "经度",
  })
  lng!: string;

  @Column({
    type: new DataType.STRING(128),
    allowNull: false,
    comment: "纬度",
  })
  lat!: string;

  @Column({
    type: new DataType.STRING,
    comment: "简介图片",
  })
  imgs!: string;

  @Column({
    type: new DataType.STRING,
    comment: "轮播图片",
  })
  swippers!: string;

  @Column({
    type: new DataType.STRING,
    comment: "简介视频",
  })
  video!: string;
  
}